package com.lhp.smp.test01.controller;

import com.lhp.smp.test01.pojo.Menu;
import com.lhp.smp.test01.pojo.Role;
import com.lhp.smp.test01.service.RoleService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
public class RoleController {
    @Resource
    private RoleService roleService;
    @GetMapping("/role/queryall")
    public List<Role> queryAll(){
        return roleService.list();
    }
    @RequestMapping("/role/add")
    public String add(){
        Role role = new Role(1,"sdjfi","sdf");
        roleService.save(role);
        return "success";
    }
    @RequestMapping("/role/update")
    public String update(){
        Role role = new Role(1,"s","sdf");
        roleService.updateById(role);
        return "success";
    }
    @RequestMapping("/role/delete")
    public String delete(){
        roleService.removeById(1);
        return "success";
    }
}
